App.controller('quotaConfigController', ['$rootScope', '$scope', '$state', 'Page', function($rootScope, $scope, $state, Page) {

	
	 Page.ajaxGet('quotaConfig/getQuotaConfigList.do', null, function(resp) {
	        $scope.quotaConfigList = resp.data;
	 });
	 
	 $scope.showEmpQuota = false;
	 
	 $scope.quotaConfingModal = {
			 save : function(){
				 var param = {};
				 param.quotaConfigList = $scope.quotaConfigList;
				 Page.ajaxPost('quotaConfig/saveQuotaConfig.do', param, function(resp) {
				        Page.notice("保存成功");
				 });
			 },
			 showEmpQuota : function(quotaConfig){
				 $scope.quotaConfig = quotaConfig;
				 $scope.quotaConfigId = $scope.quotaConfig.quotaConfigId;
				 $scope.showEmpQuota = true;
			 }
	 }
	 
	 $scope.grid = {
		        add : function() {
		            $scope.salaryEmpQuota = {};
		            $scope.modal.show();
		        },
		        update: function(row) {
		           $scope.salaryEmpQuota = row;
		           $scope.modal.show();
		        },
		        save : function() {
		            Page.ajaxPost($scope.salaryEmpQuota.empId ? 'salaryEmpQuota/update.do' : 'salaryEmpQuota/add.do', $scope.salaryEmpQuota, function() {
		                $scope.grid.query();
		                $scope.grid.cancel();
		            });
		        },
		        goBack : function() {
		        	 $scope.showEmpQuota = false;
		        },
		        column_defs: [{
		            target : 4,
		            buttons : [
		                {
		                    name: '编辑',
		                    class: 'btn-warning btm-sm',
		                    icon: 'fa-edit',
		                    event: 'update'
		                }
		                /*,
		                {
		                    name: '删除',
		                    class: 'btn-danger',
		                    icon: 'fa-close',
		                    event: function(row) {
		                        Page.confirm("确定要删除吗？", function() {
		                            Page.ajaxPost('salaryEmpQuota/delete.do', row, function() {
		                                $scope.grid.query();
		                            });
		                        });
		                    }
		                }*/
		            ]
		        }]
		    };
	 
}]);